package com.yunxi.controller.sys;

import com.yunxi.common.config.RedisCacheService;
import com.yunxi.core.web.ApiResult;
import com.yunxi.core.web.ResponseUtil;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.InvocationTargetException;

/**
 * Created by guan on 2018/10/18.
 */
@RestController
@RequestMapping("/admin/redis")
@Api(tags = "sys:redis", description = "缓存删除接口")
public class RedisController {
    private static final Logger logger = LoggerFactory.getLogger(RedisController.class);

    @Autowired
    RedisCacheService rcs;

    @GetMapping("/del")
    public ApiResult del(@RequestParam String key) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
        rcs.deleteKeys(key);
        return ResponseUtil.ok();
    }
}